
#if !defined(_KERNEL) && !defined(_STANDALONE)
#include <stdbool.h>
#endif
#include <sys/atomic.h>

#ifdef __HAVE_ATOMIC64_OPS

bool bool_compare_and_swap_8(volatile uint64_t *, uint64_t, uint64_t, ...)
    asm("__sync_bool_compare_and_swap_8");

bool
bool_compare_and_swap_8(volatile uint64_t *addr, uint64_t oldval,
	uint64_t newval, ...)
{
	return atomic_cas_64(addr, oldval, newval) == oldval;
}

#endif
